﻿namespace AzureLogProviders.Providers.EnterpriseLibrary
{
    using Microsoft.Practices.EnterpriseLibrary.Logging;
    using Microsoft.Practices.EnterpriseLibrary.Logging.Formatters;

    public class EnterpriseLogEntry : LogEntry
    {
        
        #region Fields

        /// <summary>
        /// The to string formatter
        /// </summary>
        private LogFormatter toStringFormatter;

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="EnterpriseLogEntry"/> class.
        /// </summary>
        /// <param name="formatter">The log formatter</param>
        public EnterpriseLogEntry(LogFormatter formatter)
            : base()
        {
            this.toStringFormatter = formatter;
        }

        #endregion Constructors

        #region Properties

        /// <summary>
        /// Gets the template.
        /// </summary>
        public string Template
        {
            get; private set;
        }

        #endregion Properties

        #region Methods

        /// <summary>
        /// Returns a <see cref="System.String"/> that represents this instance.
        /// </summary>
        /// <returns>
        /// A <see cref="System.String"/> that represents this instance.
        /// </returns>
        public override string ToString()
        {
            return this.toStringFormatter.Format(this);
        }

        #endregion Methods
    }
}
